package com.wtwd.campus.model.vo;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zdl
 * @Description
 * @create 2021-07-15 14:33
 */
public class TreeNode {
    //节点ID
    @JSONField(ordinal=1)
    private Integer id;

    //节点名称
    @JSONField(ordinal=2)
    private String name;

    //父节点ID
    @JSONField(ordinal=3)
    private Integer pid;

    //孩子节点集合
    @JSONField(ordinal=4)
    List<TreeNode> children = new ArrayList<>();

    public TreeNode(Integer id, String name, Integer pid) {
        this.id = id;
        this.name = name;
        this.pid = pid;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public List<TreeNode> getChildren() {
        return children;
    }

    public void setChildren(List<TreeNode> children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return "{" +
                "id:" + id +
                ", name:'" + name + '\'' +
                ", pid:" + pid +
                '}';
    }
}
